home *** CD-ROM | disk | FTP | other *** search
/ Aminet 41 / Aminet 41 (2001)(Schatztruhe)[!][Feb 2001].iso / Aminet / dev / c / libiconv_src.lha / include / iconv.h < prev   
Encoding:
C/C++ Source or Header  |  2000-11-07  |  3.9 KB  |  114 lines

  1. /* Copyright (C) 1999-2000 Free Software Foundation, Inc.
  2.    This file is part of the GNU ICONV Library.
  3.  
  4.    The GNU ICONV Library is free software; you can redistribute it and/or
  5.    modify it under the terms of the GNU Library General Public License as
  6.    published by the Free Software Foundation; either version 2 of the
  7.    License, or (at your option) any later version.
  8.  
  9.    The GNU ICONV Library is distributed in the hope that it will be useful,
  10.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12.    Library General Public License for more details.
  13.  
  14.    You should have received a copy of the GNU Library General Public
  15.    License along with the GNU ICONV Library; see the file COPYING.LIB.  If not,
  16.    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  17.    Boston, MA 02111-1307, USA.  */
  18.  
  19. /* When installed, this file is called "iconv.h". */
  20.  
  21. #ifndef _LIBICONV_H
  22. #define _LIBICONV_H
  23.  
  24. #define _LIBICONV_VERSION 0x0104    /* version number: (major<<8) + minor */
  25.  
  26. /* We would like to #include any system header file which could define
  27.    iconv_t, 1. in order to eliminate the risk that the user gets compilation
  28.    errors because some other system header file includes /usr/include/iconv.h
  29.    which defines iconv_t or declares iconv after this file, 2. when compiling
  30.    for LIBICONV_PLUG, we need the proper iconv_t type in order to produce
  31.    binary compatible code.
  32.    But gcc's #include_next is not portable. Thus, once libiconv's iconv.h
  33.    has been installed in /usr/local/include, there is no way any more to
  34.    include the original /usr/include/iconv.h. We simply have to get away
  35.    without it.
  36.    Ad 1. The risk that a system header file does
  37.    #include "iconv.h"  or  #include_next "iconv.h"
  38.    is small. They all do #include <iconv.h>.
  39.    Ad 2. The iconv_t type is a pointer type in all cases I have seen. (It
  40.    has to be a scalar type because (iconv_t)(-1) is a possible return value
  41.    from iconv_open().) */
  42.  
  43. /* Define iconv_t ourselves. */
  44. #undef iconv_t
  45. #define iconv_t libiconv_t
  46. typedef void* iconv_t;
  47.  
  48. /* Get size_t declaration. */
  49. #include <stddef.h>
  50.  
  51. /* Get errno declaration and values. */
  52. #include <errno.h>
  53. /* Some systems, like SunOS 4, don't have EILSEQ. On these systems, define
  54.    EILSEQ ourselves, but don't define it as EINVAL, because iconv() callers
  55.    want to distinguish EINVAL and EILSEQ. */
  56. #ifndef EILSEQ
  57. #define EILSEQ ENOENT
  58. #endif
  59.  
  60.  
  61. #ifdef __cplusplus
  62. extern "C" {
  63. #endif
  64.  
  65.  
  66. /* Allocates descriptor for code conversion from encoding `fromcode' to
  67.    encoding `tocode'. */
  68. #ifndef LIBICONV_PLUG
  69. #define iconv_open libiconv_open
  70. #endif
  71. extern iconv_t iconv_open (const char* tocode, const char* fromcode);
  72.  
  73. /* Converts, using conversion descriptor `cd', at most `*inbytesleft' bytes
  74.    starting at `*inbuf', writing at most `*outbytesleft' bytes starting at
  75.    `*outbuf'.
  76.    Decrements `*inbytesleft' and increments `*inbuf' by the same amount.
  77.    Decrements `*outbytesleft' and increments `*outbuf' by the same amount. */
  78. #ifndef LIBICONV_PLUG
  79. #define iconv libiconv
  80. #endif
  81. extern size_t iconv (iconv_t cd, const char* * inbuf, size_t *inbytesleft, char* * outbuf, size_t *outbytesleft);
  82.  
  83. /* Frees resources allocated for conversion descriptor `cd'. */
  84. #ifndef LIBICONV_PLUG
  85. #define iconv_close libiconv_close
  86. #endif
  87. extern int iconv_close (iconv_t cd);
  88.  
  89. extern const char* get_locale_charset (void);
  90.  
  91. extern int iconv_string (const char* tocode, const char* fromcode, const char* start, const char* end, char** resultp, size_t* lengthp);
  92.  
  93. #ifndef LIBICONV_PLUG
  94.  
  95. /* Nonstandard extensions. */
  96.  
  97. /* Control of attributes. */
  98. #define iconvctl libiconvctl
  99. extern int iconvctl (iconv_t cd, int request, void* argument);
  100.  
  101. /* Requests for iconvctl. */
  102. #define ICONV_TRIVIALP            0  /* int *argument */
  103. #define ICONV_GET_TRANSLITERATE   1  /* int *argument */
  104. #define ICONV_SET_TRANSLITERATE   2  /* const int *argument */
  105.  
  106. #endif
  107.  
  108. #ifdef __cplusplus
  109. }
  110. #endif
  111.  
  112.  
  113. #endif /* _LIBICONV_H */
  114.